package com.rew.canteenbox.functions;

import com.rew.canteenbox.R;
import com.rew.canteenbox.models.User;

import java.util.ArrayList;
import java.util.List;

/**
 *  userList init.
 *
 * Created by HuiWen Ren on 2016/11/24.
 */
public class UserInit {

    private List<User> userList;

    /*
        模拟初始化.
     */

    public UserInit(){
        userList = new ArrayList<>();

        User user1 = new User();
        user1.setName("纸乄纸");
        user1.setId(1025);
        user1.setHeadImg(R.drawable.user_head_default);
        userList.add(user1);

        User user2 = new User();
        user2.setName("Rewinder");
        user2.setId(2907);
        user2.setHeadImg(R.mipmap.ic_launcher);
        userList.add(user2);

        User user3 = new User();
        user3.setName("Akasaya");
        user3.setId(33066);
        user3.setHeadImg(R.drawable.login_btn);
        userList.add(user3);
    }

    public User findUserById(int id){
        for (User user : userList) {
            if (id == user.getId()) {
                return user;
            }
        }
        return null;
    }

}
